//
//  NSArray+Tools.h
//  MiaoPai
//
//  Created by jiaxuzhou on 2017/6/10.
//  Copyright © 2017年 Jeakin. All rights reserved.
//
//


#import <Foundation/Foundation.h>
#import "NSObject+Tools.h"


/// 数组保护
/// 是否NSArray类型
#define MPT_Ary_Class(ary) MPT_Object_Is_Class(ary, [NSArray class])

/// 是否有效，不为空，且是NSArray类型，且count值大于0
#define MPT_Ary_Is_Valid(ary) ((MPT_Object_Not_Null(ary)) && (MPT_Ary_Class(ary)) && ([ary count] > 0))
/// 是否有效，不为空，且是NSArray类型
#define MPT_Ary_Is_Valid_ExceptEmpty(ary) ((MPT_Object_Not_Null(ary)) && (MPT_Ary_Class(ary)))


/// 是否无效，或为空，或不是NSArray类型，或count值小于等于0
#define MPT_Ary_Not_Valid(ary) ((MPT_Object_Is_Null(ary)) || (!MPT_Ary_Class(ary)) || ([ary count] <= 0))
/// 是否无效，或为空，或不是NSArray类型
#define MPT_Ary_Not_Valid_ExceptEmpty(ary) ((MPT_Object_Is_Null(ary)) || (!MPT_Ary_Class(ary)))
/// 获取数组元素保护
#define MPT_Ary_GetValidObjectFromArray(array,index) mp_getValidObjectFromArray(array,index)


@interface NSArray (Tools)

id mp_getValidObjectFromArray(NSArray *array, NSInteger index);

@end
